package com.huazai.listener;

import com.huazai.bean.User;
import com.huazai.bean.User1;

import javax.servlet.ServletException;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;

@WebServlet("/session/bind")
public class HttpSessionBindingServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        HttpSession session = request.getSession();

        session.setAttribute("user", new User("123",123));
        System.out.println("-----------------------");
        session.setAttribute("user2", new User1("123",123));
        System.out.println("-----------------------");
        session.removeAttribute("user");
        session.removeAttribute("user2");


    }
}
